import Vue from "vue";
import Vuex from "vuex";
import createPersistedState from "vuex-persistedstate";
import header from "./modules/header";
import menu from "./modules/menu";
import router from "./modules/router";

const persistedStateConfig = {
  key: "store",
  render: state => {
    return { ...state };
  }
};

Vue.use(Vuex);

const store = new Vuex.Store({
  modules: {
    header,
    menu,
    router
  },
  plugins: [createPersistedState(persistedStateConfig)]
});

export default store;
